//
//  Extension.swift
//  ZqlSinaWeiBo
//
//  Created by 赵乾龙 on 16/2/17.
//  Copyright © 2016年 Mr.zhao. All rights reserved.
//

import UIKit

extension UILabel{
    class func factoryLabel(text:String,fontSize:CGFloat,textColor:UIColor) -> UILabel {
        let l=UILabel()
        l.text=text
        l.font = UIFont.systemFontOfSize(fontSize)
        l.textColor=textColor
        l.numberOfLines=0
        l.textAlignment = .Center
        l.sizeToFit()
        return l
    }
    
    
    convenience init(text: String, fontSize: CGFloat,textColor: UIColor,alignment:NSTextAlignment = .Center) {
        //获取到一个UILabel类型的对象
        self.init()
        
        self.text = text
        font = UIFont.systemFontOfSize(fontSize)
        self.textColor = textColor
        //设置行数为 0
        numberOfLines = 0
        //设置对其
        textAlignment = alignment
        //自适应大小
        sizeToFit()
    }

    
}
